package components;

public final class PrevailCond {

	private final Variable var;
	private final int value;
	
	public PrevailCond(Variable v,int x) throws Exception{
		var=v;
		value=x;
		if (x>var.getDomain())
			throw new Exception("illegal prevail cond value or effect cant be bigger then domain");
	}
	
	public boolean confirm(){
		return (var.getState()==value);
	}
/**
 * output string
 * @return
 */
	public String toString2() {
		return var.getIndex()+" "+value+"\n";
	}
/**
 * getter
 * @return
 */
	public Variable getVar() {
		return var;
	}
	
	public int getValue(){
		return this.value;
	}
	
}
